package cn.itcast.dao;

import cn.itcast.pojo.Address;
import com.alibaba.dubbo.config.annotation.Service;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import java.util.List;

public interface AddressDao {

    //查询所有分院信息
    @Select("select * from t_address")
    List<Address> findAll();

    //添加分院信息
    @Insert("insert into t_address values(#{id},#{code},#{name},#{address},#{detail},#{coordinate},#{enable})")
    Boolean submit(Address address);

   //删除分院信息
   @Delete("delete from t_address where  id = #{id}")
    Boolean delete(Integer id);

   //根据单个id查询分院
    @Select("select * from t_address where id = #{id}")
    Address findById(Integer id);

    //修改
    @Update("update t_address set code=#{code},name=#{name},address=#{address},detail=#{detail},coordinate=#{coordinate},enable=#{enable} where id = #{id}")
    boolean addressUpdate(Address address);

    //是否启用
    @Update("update t_address set enable=#{enable} where id=#{id}")
    boolean enableUpdate(String enable, Integer id);
}
